package com.lik.javadeep;

import java.util.LinkedHashMap;
import java.util.Map;

public class LinkedHashMapTest {
    public static void main(String[] args) {
        LinkedHashMap<String, Object> map = new LinkedHashMap<String, Object>(16,0.75f,true) {

            @Override
            protected boolean removeEldestEntry(Map.Entry<String, Object> eldest) {
                return this.size() > 3;
            }
        };

        map.put("1",1);
        map.put("2",2);
        map.put("3",3);
        map.put("4",4);

        System.out.println(map);
        map.get("2");
        System.out.println(map);
        map.get("3");
        System.out.println(map);
        map.get("4");
        System.out.println(map);
    }
}
